<style>
    .projectName .popover {
        max-width: 400px !important;
    }
</style>
<div class="modal-header">
    <h3 class="modal-title">
        <b style="color: #286090">编辑标签</b>
    </h3>
</div>
<div class="modal-body">

    <form class="bs-example form-horizontal">
        <div class="wrapper-md">
            <toaster-container
                    toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>

            <div class="col-md-6">
                <label class="col-lg-4 control-label"><span style="color: #ec2121;">*</span>选择标签</label>
                <div class="col-lg-8">

                    <select class="form-control" ng-model="nowLabel.selected" ng-change="queryLabelApp('')"
                            ng-options="label as label.labelName for label in labelList">
                        <option value="">--请选择--</option>
                    </select>
                </div>
            </div>


            <div class="form-group">
                <div class="col-md-6">
                    <label class="col-lg-4 control-label"><span style="color: #ec2121;">*</span>标签名称
                    </label>
                    <div class="input-group" style="padding-left: 15px; padding-right: 15px">
                        <input type="text" class="form-control" placeholder="任务名称"
                               ng-model="nowLabel.selected.labelName">
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label class="col-lg-2 control-label">说明</label>
                <div class="col-lg-10">
                    <textarea class="form-control" cols="3" placeholder="简短描述"
                                      ng-model="nowLabel.selected.content"></textarea>
                </div>
            </div>


            <div class="form-group" ng-show="nowLabel.selected != null">
                <label class="col-lg-2 control-label"><span style="color: #ec2121;">*</span>选择应用</label>
                <div class="col-lg-4">
                    <ui-select ng-model="nowApp.selected" theme="bootstrap" >
                        <ui-select-match placeholder="搜索应用名称......">{{$select.selected.appName}}</ui-select-match>
                        <ui-select-choices refresh="queryLabelApp($select.search)" refresh-dalay="0"
                                           repeat="item in appList | filter: $select.search">
                            <div ng-bind-html="item.appName | highlight: $select.search"></div>
                        </ui-select-choices>
                    </ui-select>
                </div>

                <div class="col-lg-2" ng-show="nowApp.selected != null">
                    <button ng-click="addMember()" class="btn btn-xs"
                            style="margin-top: 5px; background-color: limegreen; color: white;"
                            uib-popover-html="'添加'" popover-trigger="'mouseenter'">
                        <span class="glyphicon glyphicon-plus"></span>添加
                    </button>
                </div>

            </div>

            <table class="table table-hover table-bordered table-striped">
                <thead>
                <tr>
                    <td>应用列表</td>
                    <td class="col-md-2">操作</td>
                </tr>
                </thead>
                <tbody>
                <tr ng-repeat="member in nowLabel.selected.memberList">
                    <td>
                        <b style="color: #286090">{{member.appName}}</b>
                    </td>
                    <td>
                        <button class="btn btn-xs pull-right"
                                style="background-color: #d9534f; color: white;"
                                uib-popover-html="'移除'" popover-trigger="'mouseenter'"
                                ng-click="delMember(member.id)">
                            <span class="glyphicon glyphicon-remove"></span>移除
                        </button>
                    </td>
                </tr>
                </tbody>
            </table>


            <div class="form-group">
                <div style="text-align:center;">
                    <div style="text-align:center;">
                        <button ng-click="saveLabel()"
                                class="btn btn-xs"
                                style="margin-left: 5px; background-color: #2e6da4; color: white;">
                            <span class="glyphicon glyphicon-ok"></span>保存
                        </button>
                    </div>
                </div>
            </div>

        </div>
    </form>

    <div>
        <div ng-include="'tpl/modal/public/pub_alert.html'"></div>
    </div>
</div>